"""
    质检单查询页面
"""

from pages.add_gown_page import AddGownPage
from playwright.sync_api import expect, Page
import pytest

class ChecklistPage:
    def __init__(self, page: Page):
        self.add_project = AddGownPage(page)
        self.page = page
        self.weight = self.add_project.weight

    # 查询质检单，默认查询待质检仓单
    def qualityInspection(self):
        self.page.goto("/#/instorage/qualityInspection")
        self.page.wait_for_timeout(3000)
        # 定位表格
        n = self.page.locator('//*[@class="arco-table-element"]/tbody/tr[1]/td[3]')
        print(n.inner_text())  # 获取第1行第3列数据
        return n.inner_text()

    # 查询质检单列表仓单编号
    def orderInspection(self):
        self.page.goto("/#/instorage/qualityInspection")
        self.page.wait_for_timeout(3000)
        # 定位表格
        n = self.page.locator('//*[@class="arco-table-element"]/tbody/tr[1]/td[3]')
        print(n.inner_text())  # 获取第1行第3列数据
        return n.inner_text()

    # 质检操作,编辑数据后提交
    def orderEdit(self):
        self.page.goto("/#/instorage/qualityInspection")
        # 定位表格
        n = self.page.locator('//*[@class="arco-table-element"]/tbody/tr[1]/td[1]')
        print(n.inner_text())  # 获取第1行第1列数据
        # self.page.get_by_placeholder("请输入入库单编号").click()
        # self.page.get_by_placeholder("请输入入库单编号").fill(n.inner_text())
        # self.page.get_by_role("button", name="查询").click()
        # 点击列表第一行数据"质检"
        self.page.get_by_role("row").locator("a").nth(1).click()
        # 编辑质检单
        self.page.locator("input[type=\"text\"]").first.click()
        self.page.locator("input[type=\"text\"]").first.fill("001")
        self.page.locator("input[type=\"text\"]").nth(1).click()
        self.page.locator("input[type=\"text\"]").nth(1).fill("5")
        self.page.locator("input[type=\"text\"]").nth(2).click()
        self.page.locator("input[type=\"text\"]").nth(2).fill("5")
        self.page.locator("input[type=\"text\"]").nth(3).click()
        self.page.locator("input[type=\"text\"]").nth(3).fill("0")
        self.page.locator(".arco-select-view-input").first.click()
        self.page.get_by_text("抽检").click()
        self.page.locator('(//input[@class="arco-select-view-input"])[1]').click()
        self.page.get_by_text("合格，符合做代理业务").click()
        self.page.get_by_placeholder("请选择质检时间").click()
        self.page.get_by_text("今天").click()
        self.page.get_by_role("button", name="保存并确认质检").click()



















